home *** CD-ROM | disk | FTP | other *** search
/ Champak 130 / Vol 130.iso / games / target_s.swf / scripts / sidewalk.as < prev    next >
Encoding:
Text File  |  2008-11-13  |  2.0 KB  |  75 lines

  1. package
  2. {
  3.    import flash.display.*;
  4.    
  5.    [Embed(source="/_assets/assets.swf", symbol="sidewalk")]
  6.    public class sidewalk extends MovieClip
  7.    {
  8.        
  9.       
  10.       private var linePoints:Array;
  11.       
  12.       private var scope:Object;
  13.       
  14.       private var lines:Sprite;
  15.       
  16.       public function sidewalk(param1:*)
  17.       {
  18.          linePoints = new Array();
  19.          lines = new Sprite();
  20.          super();
  21.          scope = param1;
  22.          addChild(lines);
  23.          lines.graphics.lineStyle(1,10066329);
  24.          setLines();
  25.       }
  26.       
  27.       private function drawLine(param1:*) : *
  28.       {
  29.          var _loc2_:* = undefined;
  30.          var _loc3_:* = undefined;
  31.          var _loc4_:* = undefined;
  32.          var _loc5_:* = undefined;
  33.          _loc2_ = scope.pp.x + 100 - param1;
  34.          _loc3_ = scope.pp.y - (y + 35);
  35.          _loc4_ = Math.atan2(_loc3_,_loc2_);
  36.          _loc5_ = -35 * (1 / Math.tan(_loc4_));
  37.          lines.graphics.moveTo(param1,35);
  38.          lines.graphics.lineTo(param1 + _loc5_,0);
  39.       }
  40.       
  41.       public function process() : *
  42.       {
  43.          var _loc1_:* = undefined;
  44.          var _loc2_:* = undefined;
  45.          lines.graphics.clear();
  46.          lines.graphics.lineStyle(1,10066329);
  47.          _loc1_ = scope.vx * ((y + 35 - scope.pp.y) / scope.pp.y);
  48.          if(linePoints[0] - _loc1_ < 0)
  49.          {
  50.             linePoints.shift();
  51.             linePoints.push(linePoints[linePoints.length - 1] + 100);
  52.          }
  53.          _loc2_ = 0;
  54.          while(_loc2_ < linePoints.length)
  55.          {
  56.             linePoints[_loc2_] -= _loc1_;
  57.             drawLine(linePoints[_loc2_]);
  58.             _loc2_++;
  59.          }
  60.       }
  61.       
  62.       private function setLines() : *
  63.       {
  64.          var _loc1_:* = undefined;
  65.          _loc1_ = 0;
  66.          while(_loc1_ <= 900)
  67.          {
  68.             linePoints.push(_loc1_);
  69.             drawLine(_loc1_);
  70.             _loc1_ += 100;
  71.          }
  72.       }
  73.    }
  74. }
  75.